#ifndef __PUBLIC_H__
#define __PUBLIC_H__
#include<unordered_map>
#include<string>
const int SMALL_BUF_LEN = 128;
const int MEDIUM_BUF_LEN = 512;
const int LARGE_BUF_LEN = 1024;
/* * * * * * 色号 * * * * * 
 * "\033[30;1m黑色\033[0m"
 * "\033[31;1m红色\033[0m"
 * "\033[32;1m绿色\033[0m"
 * "\033[33;1m黄色\033[0m"
 * "\033[34;1m蓝色\033[0m"
 * "\033[35;1m紫色\033[0m"
 * "\033[36;1m青色\033[0m"
 * "\033[37;1m白色\033[0m"
 */
enum COLOR_NUMBER
{
    DEFAULT_COLOR = 0,
    INFO_COLOR = 36,    //青色
    ERROR_COLOR = 31,   //红色
    DEBUG_COLOR = 32,   //绿色
    FATAL_COLOR = 33,   //黄色
    LINE_COLOR = 32,    //绿色
    FUNCTION_COLOR = 34,//蓝色
    FILE_COLOR = 35     //紫色
};
/* 日志级别 */ 
enum LOG_LEVEL
{
    INFO = 0,
    ERROR,
    DEBUG,
    FATAL
};
/* LOG的字段(field) */
enum LOG_FIELD
{
    LINE_NUMBER = 0,
    FUNCTION_NAME,
    FILE_NAME
};
static std::unordered_map<LOG_LEVEL, COLOR_NUMBER> LogLevelColor = {
    {INFO, INFO_COLOR},
    {ERROR, ERROR_COLOR},
    {DEBUG, DEBUG_COLOR},
    {FATAL, FATAL_COLOR}
};
static std::unordered_map<LOG_FIELD, COLOR_NUMBER> LogFieldColor = {
    {LINE_NUMBER, LINE_COLOR},
    {FUNCTION_NAME, FUNCTION_COLOR},
    {FILE_NAME, FILE_COLOR}
};
static std::unordered_map<LOG_LEVEL, std::string> LogLevelType = {
    {INFO, "[INFO]"},
    {ERROR, "[ERROR]"},
    {DEBUG, "[DEBUG]"},
    {FATAL, "[FATAL]"}
};
static std::unordered_map<std::string, LOG_LEVEL> LogLevelStringType = {
    {"INFO", INFO},
    {"ERROR", ERROR},
    {"DEBUG", DEBUG},
    {"FATAL", FATAL}
};
#endif